package sg.edu.nus.iss.billing.validation;

import java.lang.reflect.Type;

import sg.edu.nus.iss.billing.exception.ValidationException;


public class FieldConverter {
	
	public static Object valueOf(String s, Type t) throws ValidationException {
		try {
			if (t == Integer.class) {
				return Integer.valueOf(s);
			} else {
				return null;
			}
		} catch (NumberFormatException e) {
			throw new ValidationException(e.getMessage());
		}
	}
	
}
